<!DOCTYPE html>
<html>
  <head>
    <script src="../../../../processing.js"></script>
    <link rel="stylesheet" href="../../../style.css" />
  </head> 

  <body> 
    <h1><a href="http://www.processing.org/reference/screenY_.html">Processing.org</a></h1>
    <h2>Test for screenX(), screenY(), screenZ()</h2>

    <p>This pages tests screenY().<br />
    <p>
      <canvas datasrc="screenX.pjs" width="100" height="100"> </canvas>
    </p>
    
    <pre>
void setup() {
  size(100, 100, P3D);
}

void draw() {
  background(204);
  
  float x = mouseX;
  float y = mouseY;
  float z = -100;
  
  // Draw "X" at z = -100
  stroke(255);
  line(x-10, y-10, z, x+10, y+10, z); 
  line(x+10, y-10, z, x-10, y+10, z); 
  
  // Draw line in 2D at same x value
  // Notice the parallax
  stroke(102);
  line(x, 0, 0, x, height, 0);
  
  // Draw 2D line to match the x value
  // element drawn at z = -100 
  stroke(0);
  float theX = screenX(x, y, z);
  line(theX, 0, 0, theX, height, 0);    
}</pre>

  </body>
</html>
